/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.trade;


import com.enation.app.javashop.client.trade.PintuanOrderClient;
import com.enation.app.javashop.core.client.fallback.trade.PintuanOrderClientFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.promotion.pintuan.PintuanChildOrder;
import com.enation.app.javashop.model.promotion.pintuan.PintuanOrderDetailVo;
import com.enation.app.javashop.model.trade.order.dos.OrderDO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 拼团订单操作SDK
 *
 * @author fk create in 2020/4/7
 * @version v2.0
 * @since v7.2.0
 */
@FeignClient(name = "trade-service", fallbackFactory = PintuanOrderClientFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface PintuanOrderClientFeignImpl extends PintuanOrderClient {

    /**
     * 通过普通订单号查找拼团主订单
     * @param orderSn
     * @return
     */
    @Override
    @GetMapping("/client/pintuan/order/{order_sn}")
    PintuanOrderDetailVo getMainOrderBySn(@PathVariable("order_sn") String orderSn);

    /**
     * 取消拼团订单
     * @param orderSn 订单号
     */
    @PutMapping("/client/pintuan/order/{order_sn}/cancel")
    @Override
    void cancelOrder(@PathVariable("order_sn") String orderSn);


    /**
     * 对一个拼团订单进行支付处理
     * @param order 普通订单
     */
    @PutMapping("/client/pintuan/order/pay")
    @Override
    void payOrder(@RequestBody OrderDO order);

    /**
     * 拼团主id查询相关的拼团订单
     * @param pintuanOrderId
     * @return
     */
    @GetMapping("/client/pintuan/{order_id}/child-order")
    @Override
    List<PintuanChildOrder> queryChildOrderByOrderId(@PathVariable("order_id") Long pintuanOrderId);

}
